#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void duplicateZeros(int* arr, int arrSize) {
    int dest = -1, cur = 0, n = arrSize;
    while (cur<n)
    {
        if (arr[cur] == 0)
            dest+= 2;
        else
            dest++;
        if (dest >= n - 1)break;
        cur++;
    }
    if (dest == n)
    {
        arr[n - 1] = 0;
        cur--;
        dest -= 2;
    }
    while (cur >= 0)
    {
        if (arr[cur] == 0)
        {
            arr[dest--] = 0;
            arr[dest--] = 0;
            cur--;
        }
        else
            arr[dest--] = arr[cur--];
    }
}
int main()
{
    int arr[3] = { 1,2,0 };
    duplicateZeros(arr, 3);
    for (int i = 0; i < 3; i++)
    {
        printf("%d", arr[i]);
    }
    return 0;
}
